package com.geek.spring.bucks.model;

import java.io.Serializable;
import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Type;
import org.joda.money.Money;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

@RedisHash(value = "bucks-coffee", timeToLive = 60)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Coffee implements Serializable {
    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_COFFEE.ID
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    @Id
    private Long id;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_COFFEE.CREATE_TIME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    private Date createTime;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_COFFEE.UPDATE_TIME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    private Date updateTime;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_COFFEE.NAME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    @Indexed
    private String name;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_COFFEE.PRICE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    @Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyMinorAmount",
            parameters = {@org.hibernate.annotations.Parameter(name = "currencyCode", value = "CNY")})
    private Money price;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table T_COFFEE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    private static final long serialVersionUID = 1L;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_COFFEE.ID
     *
     * @return the value of T_COFFEE.ID
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Long getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_COFFEE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Coffee withId(Long id) {
        this.setId(id);
        return this;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_COFFEE.ID
     *
     * @param id the value for T_COFFEE.ID
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_COFFEE.CREATE_TIME
     *
     * @return the value of T_COFFEE.CREATE_TIME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_COFFEE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Coffee withCreateTime(Date createTime) {
        this.setCreateTime(createTime);
        return this;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_COFFEE.CREATE_TIME
     *
     * @param createTime the value for T_COFFEE.CREATE_TIME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_COFFEE.UPDATE_TIME
     *
     * @return the value of T_COFFEE.UPDATE_TIME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Date getUpdateTime() {
        return updateTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_COFFEE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Coffee withUpdateTime(Date updateTime) {
        this.setUpdateTime(updateTime);
        return this;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_COFFEE.UPDATE_TIME
     *
     * @param updateTime the value for T_COFFEE.UPDATE_TIME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_COFFEE.NAME
     *
     * @return the value of T_COFFEE.NAME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public String getName() {
        return name;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_COFFEE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Coffee withName(String name) {
        this.setName(name);
        return this;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_COFFEE.NAME
     *
     * @param name the value for T_COFFEE.NAME
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_COFFEE.PRICE
     *
     * @return the value of T_COFFEE.PRICE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Money getPrice() {
        return price;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_COFFEE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public Coffee withPrice(Money price) {
        this.setPrice(price);
        return this;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_COFFEE.PRICE
     *
     * @param price the value for T_COFFEE.PRICE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    public void setPrice(Money price) {
        this.price = price;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_COFFEE
     *
     * @mbg.generated Sun Mar 05 13:01:52 CST 2023
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", name=").append(name);
        sb.append(", price=").append(price);
        sb.append("]");
        return sb.toString();
    }
}